<template>
	<view class="preorderSuccess">
		<view class="icon">
			<i class='iconfont '>&#xe608;</i>
			<text>预购成功！请在{{tailConfirmTime}}内支付尾款</text>
		</view>
		<view class="btnGroup">
			<view class="back" @click="backHome">
				回首页
			</view>
			<view class="back viewOrder" @click="viewOrder">
				查看订单
			</view>
		</view>
		<view class="footer">
			<text class="title">温馨提示:</text>
			<view class="content">
				<view>· 请在{{tailConfirmTime}}内将剩余款项支付到视纪影视对公账号，平台
将为您预留认购份数</view>
				<view>· 如超时未支付尾款，定金将退还至您的钱包</view>
				<view>· 超时后，平台将取消您的认购份数</view>
				<view>· 公司名称：<text class="bold">四川国锐影视传媒有限公司</text></view>
				<view>· 开户行：<text class="bold">中国民生银行股份有限公司成都蜀汉支行</text></view>
				<view>· 对公账号：<text class="bold">151224277</text></view>
				<view>· 如有其它疑问，请拨打平台热线咨询：<text class="red" @tap="makePhoneCall">02885081413</text></view>
			</view>
		</view>
		
	</view>
</template>

<script>
	var util = require('../../common/util.js');
export default {
    data() {
        return {
			orderId:0,
			tailConfirmTime:'',
		};
    },
	onLoad(e) {
		this.orderId  = e.id
		this.globalRuleGet();
	},
    methods: {
		 makePhoneCall: function() {
		    uni.makePhoneCall({
		        phoneNumber: '02885081413',
		        success: () => {
		            console.log('成功拨打电话');
		        }
		    });
		},
		globalRuleGet() {
			util.ajax(
				'globalRuleGet',
				{
					token: util.getUserToken()
				},
				data => {
					let json = data.data;
					if (json.status) {
						// console.log(json.data.rule.tailConfirmHour);
						let tailConfirmHour = json.data.rule.tailConfirmHour;
						// console.log(tailConfirmHour)
						if(+tailConfirmHour>60){
							this.tailConfirmTime =+tailConfirmHour %60 !=0? parseInt(+tailConfirmHour/60 )+"小时" +tailConfirmHour%60 +"分钟" :parseInt(+tailConfirmHour/60 )+"小时"
						}else{
							this.tailConfirmTime = tailConfirmHour+'分钟'
						}
						console.log(this.tailConfirmTime)
					} else {
						uni.showToast({
							title: json.message,
							icon: 'none',
							duration: 1000
						});
					}
				},
				(data, code) => {
					console.log(data);
					uni.showToast({
						title: JSON.stringify(data.message),
						icon: 'none',
						duration: 1000
					});
				}
			);
		},
        backHome() {
            uni.reLaunch({
            	url: '../project/index'
            })
        },
        viewOrder() {
            uni.navigateTo({
                url: '../my/myinvestDetail?id='+this.orderId
            });
        }
    }
};
</script>

<style lang="less">
@import '../../common/icon.css';
.preorderSuccess {
    flex: 1;
    flex-direction: column;
    width: 100%;
    height: auto;
    // background: #f4f4f4;
    .icon {
        flex-direction: column;
		justify-content:center;
        .iconfont {
            font-size: 150upx;
            color: #ff1268;
            margin: 180upx auto 60upx;
        }
        text {
            font-size: 30upx;
            color: #666666;
            text-align: center;
        }
    }
    .btnGroup {
        width: 76%;
        margin: 110upx auto 60upx;
        justify-content: space-between;
        .back {
            background: white;
            width: 262upx;
            height: 100upx;
            border-radius: 50upx;
            justify-content: center;
            align-items: center;
            color: #222222;
            font-size: 32upx;
            font-weight: 600;
        }
        .viewOrder {
            color: #ff1268;
            margin-left: 50upx;
        }
    }
    .footer {
        border-top: 1px solid #dddddd;
        flex-direction: column;
        margin: 30upx 52upx;
        box-sizing: border-box;
        color: #333333;
        font-size: 28upx;
        padding-top: 52upx;
        .title {
            margin-bottom: 16upx;
        }
        .content {
            flex-direction: column;
			
            view {
				font-size: 26upx;
                line-height: 2;
				display: block;
				.bold{
					font-weight: 600;
					font-weight: bold;
				}
				.red{
					color: #FF1268;
				}
            }
        }
    }
}
</style>
